package com.yfp.machine.service.impl;

import com.yfp.machine.domain.AdPushRecord;
import com.yfp.machine.mapper.AdPushRecordMapper;
import com.yfp.machine.service.AdPushRecordService;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

import java.util.List;

/**
 * 广告推送表(AdPushRecord)表服务实现类
 *
 * 
 * @since 2024-01-07 15:56:07
 */
@Service("adPushRecordService")
public class AdPushRecordServiceImpl implements AdPushRecordService {
    @Resource
    private AdPushRecordMapper adPushRecordMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param recordNo 主键
     * @return 实例对象
     */
    @Override
    public AdPushRecord queryById(String recordNo) {
        return this.adPushRecordMapper.queryById(recordNo);
    }

    /**
     * 分页查询
     *
     * @param adPushRecord 筛选条件
     * @return 查询结果
     */
    @Override
    public List<AdPushRecord> queryByPage(AdPushRecord adPushRecord) {
        return this.adPushRecordMapper.queryAllByLimit(adPushRecord);
    }

    /**
     * 新增数据
     *
     * @param adPushRecord 实例对象
     * @return 实例对象
     */
    @Override
    public AdPushRecord insert(AdPushRecord adPushRecord) {
        this.adPushRecordMapper.insert(adPushRecord);
        return adPushRecord;
    }

    /**
     * 修改数据
     *
     * @param adPushRecord 实例对象
     * @return 实例对象
     */
    @Override
    public AdPushRecord update(AdPushRecord adPushRecord) {
        this.adPushRecordMapper.update(adPushRecord);
        return this.queryById(adPushRecord.getRecordNo());
    }
}
